﻿using System;

namespace ExceptDev
{
    public class UserException : Exception
    {
        public int ErrCode { get; private set; }
        public string ErrMessage { get; private set; }

        public UserException() { }

        public UserException(AuthCode errorCode)
        {
            ErrCode = (int)errorCode;
            ErrMessage = EnumHelper.GetDescription(errorCode);

            //base(errMessage);
        }

        public UserException(int errorCode, string message)
            : base(message)
        {
            ErrCode = errorCode;
            ErrMessage = message;
        }

        public UserException(int errorCode, string message, Exception innerException)
            : base(message, innerException)
        {
            ErrCode = errorCode;
            ErrMessage = message;
        }

        public override string ToString() { return string.Format("[{0}] {1}", ErrCode, Message); }
    }
}
